package com.xuecheng.media.config;
/**
 * @author hjh
 * @data 2023/5/8 13:38
 * @version 1.0
 */

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *@author hjh
 *@since 2023/5/8
 *@Description TODO
 */

@Configuration
public class MinioConfig {

    @Value("${minio.endpoint}")
    private String endpoint;

    @Value("${minio.accessKey}")
    private String accessKey;

    @Value("${minio.secretKey}")
    private String secretKey;

    /**
     * 创建minioclient客户端
     * @author hjh
     * @date 2023/5/8 13:42
     * @return MinioClient
     */

    @Bean
    public MinioClient minioClient(){
        return new MinioClient.Builder().endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}
